<?php

	require_once("ValidateLoginInfo.php");	
	

class CheckLoginForm
{
	/**
	 * @var $UserPassword, string
	 */
	private $postUsername;

	/**
	 * @var $postUserPassword, string
	 */
	private $loggedInSession;
	
	/**
	 * @var $postUserPassword, string
	 */
	private $postUserPassword;

	
	/**
	 * @param $username, string
	 * 
	 * @param $userPassword, string
	 * 
	 * @param $loggedIn, boolean
	 */
	public function __construct($username, $userPassword,$loggedIn)
	{
		$this->postUsername = $username;
		$this->loggedInSession = $loggedIn;
		$this->postUserPassword = $userPassword;
	}

	/**
	 * @return boolean
	 */
    public function CheckLoginInfo() 
	{
		if(!empty($this->postUsername) && !empty($this->postUserPassword)&& $this->loggedInSession === false)
	    {
    	    $validateLoginInfo = new ValidateLoginInfo();
			$loggedIn = $validateLoginInfo->LoginValidation( 
			$this->postUsername, $this->postUserPassword );					  												
			
			if($loggedIn === false)
			{	
				return false;
			}
			elseif($loggedIn === true)
			{	
				return true;
			}
	    }
	}
	
	
	/**
	 * @return boolean
	 */
	public function IsPasswordMissing()
	{
		// IF USERNAME BUT NO PASSWORD. 
		if(!empty($this->postUsername) && empty($this->postUserPassword))
		{
			return true;
		}
		else
		{	
			return false;
		}
	}
	
	/**
	 * @return boolean
	 */
	public function IsUsernameMissing()
	{
		if(empty($this->postUsername))
		{
			return true;
		}
		else 
		{ 
			return false;
		}
	}
	
	
	
}
